<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View custom link</title>
</head>
<body>

	<c:if test="${ empty viewedLink }">
		greška
	</c:if>
	
	<c:if test="${ not empty viewedLink }">
		<table>
			<tr>
				<td><label for="originalUrl">Original url</label></td>
				<td>
					<a href="${ viewedLink.originalUrl }">${ viewedLink.originalUrl }</a>
				</td>
			</tr>
			<tr>
				<td><label for="customUrl">Custom url</label></td>
				<td>${ viewedLink.customUrl }</td>
			</tr>
			<tr>
				<td><label for="visibility">Visibility</label></td>
				<td>${ viewedLink.visibility }</td>
			</tr>
			<tr>
				<td><label for="count">Link viewed</label></td>
				<td>${ viewedLink.count }</td>
			</tr>
			<tr>
				<td><label for="creationTime">Creation time:</label></td>
				<td>${ viewedLink.creationTime }</td>
			</tr>
			<tr>
				<td><label for="modificationTime">Modification time:</label></td>
				<td>${ viewedLink.modificationTime }</td>
			</tr>
			<tr>
				<td><label for="Created by">created by:</label></td>
				<c:choose>
					<c:when test="${ not empty user }">
						<td>${ viewedLink.createdBy }</td>
					</c:when>
					<c:otherwise>
						<td>anonymous user</td>
					</c:otherwise>
				</c:choose>
			</tr>
			<tr>
				<c:if test="${ not empty user }">
				<td><a href="${pageContext.request.contextPath}/edit/${viewedLink.customUrl}">Edit</a></td>
				</c:if>
				<td><a href="${pageContext.request.contextPath}/delete/${viewedLink.customUrl}">Delete</a></td>
			</tr>
		</table>
	</c:if>

</body>
</html>